/**
 * 给定N，问是否能够分解成三个Fib数之和
 * 注意到Fib数没有多少，首先将所有Fib数能够构成的数保存起来
 * 然后查询即可
 */
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;

template<typename T>
void input(vector<T> & v, int n){
	v.assign(n + 1, {});
	for(int i=1;i<=n;++i) cin >> v[i];
	return;
}

using Real = long double;
using llt = long long;
using vi = vector<int>;
using pii = pair<int, int>;

vector<llt> Fib;
map<llt, array<llt, 3>> Z;

void init(){
    Fib.emplace_back(0);
	Fib.emplace_back(1);
	Fib.emplace_back(2);
	while(1){
		llt t = Fib.back() + *----Fib.end();
		if(t >= 1E9) break;
		Fib.emplace_back(t);
	}
	for(auto i : Fib)for(auto j : Fib)for(auto k : Fib){
		auto t = i + j + k;
		if(t <= 1E9){
			Z[t] = {i, j, k};
		}
	}
	// sort(Z.begin(), Z.end());
	// Z.erase(unique(Z.begin(), Z.end()), Z.end());
	return;
}


void work(){
    int n; cin >> n;
	auto it = Z.find(n);
	if(it != Z.end()){
		cout << it->second[2] << " " << it->second[1] << " " << it->second[0] << "\n";
	}else{
		cout << "-1\n";
	}
	return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	init();
	int nofkase = 1;
    cin >> nofkase;
    while(nofkase--) work();
    return 0;
}